﻿using System;
using System.ComponentModel.Design;
using System.ComponentModel;

namespace EditorLibrary
{
    public class MSBuildDesigner : IDesigner
    {
        IComponent _component;
        DesignerVerbCollection actions;

        public System.ComponentModel.IComponent Component
        {
            get
            {
                return _component;
            }
        }

        public void DoDefaultAction()
        {
            // MsgBox.Show("The DoDefaultAction method of an IDesigner implementation was invoked.", "Information");
        }

        public void Initialize(System.ComponentModel.IComponent component)
        {
            this._component = component;
        }

        public DesignerVerbCollection Verbs
        {
            get
            {
                if (actions == null)
                    actions = new DesignerVerbCollection();

                DesignerVerb dv1 = new DesignerVerb("Display Component Name", new EventHandler(this.ShowComponentName));
                actions.Add(dv1);

                return actions;
            }
        }

        private void ShowComponentName(object sender, EventArgs e)
        {
            if (_component != null)
            {
                //MessageBox.Show(this.Component.Site.Name, "Designer Component's Name");"
            }
        }

        public void Dispose()
        {
            throw new NotImplementedException();
        }
    }
}
